<?php

namespace app\admin\model;

use think\Model;

class GoodsImage extends Model{
    protected $pk = 'image_id';

    protected $error;
    public function getError(){
        return $this->error;
    }
    public function add(array $data,array $allowField = [],bool $replace = false){
        try{
            if(empty($data)){
                $this->error = '数据不为空';
            }
        echo "<pre>";
        print_r($data);
        echo "</pre>";
            $this->replace($replace)->save($data);
            $id = $this->toArray();
            return $id[$this->pk];
        }catch(\Exception $e){
            $this->error = $e->getMessage();
            return false;
        }
    }
    public function getimage()
    {
        $model = self::select();

        return $model;
    }
}